package com.lagou.mr.order;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Partitioner;

public class CustomPartitioner extends Partitioner<OrderBean, NullWritable> {
    @Override
    public int getPartition(OrderBean orderBean, NullWritable nullWritable, int i) {
        //自定义分区，根据订单ID进行分区到reduce
        return ( orderBean.getOrderId().hashCode() & Integer.MAX_VALUE ) % i;
    }
}
